﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace SHomeWorkshop.LunarSF.StudentInfosManager.Converters
{
    [ValueConversion(typeof(string), typeof(string))]
    public class PersonCountConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var valueText = value as string;
            if (string.IsNullOrWhiteSpace(valueText)) return "";

            return valueText;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var valueText = value as string;
            if (string.IsNullOrWhiteSpace(valueText)) return "";

            return valueText;
        }

        private static PersonCountConverter converter = new PersonCountConverter();

        public static PersonCountConverter Instance
        {
            get { return converter; }
        }
    }
}
